package edu.hitsz;

import edu.hitsz.application.Game;
import edu.hitsz.application.Main;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ComFirmDelete {
    private JPanel mainPanel;
    private JPanel buttonPanel;
    private JPanel textPanel;
    private JLabel label;
    private JButton yesButton;
    private JButton noButton;
    private JButton returnButton;

    public ComFirmDelete() {
        returnButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Ranking.frame.dispose();
            }
        });
        noButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Ranking.frame.dispose();
            }
        });
        yesButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int row = setName.ranking.row;
                setName.rankListDAO.doDelete(row);
                Ranking.model.removeRow(row);
                Ranking.frame.dispose();
            }
        });
    }

    public JPanel getMainPanel() {
        return mainPanel;
    }


}
